<?php
//用户账户密码登陆接口
include '../../php/conn.php'; 
if ($con) {
	if ($_POST) {
		$TMuer = $_POST['TMuer'];
		$Aduerpwd = $_POST['Aduerpwd'];
		$TMClassify=$_POST['TMClassify'];
		//md5加密
		//$userInfo_Pwd = md5(md5($userInfo_Pwd)); 
		//判断账号是否正确
		$masql = "SELECT * FROM teachermanagement WHERE TMuer='$TMuer'"; 
		$msy=mysql_query($masql); 
		if ($msy) {
			$mynamesql = mysql_num_rows($msy);
			if ($mynamesql == 1) {
				$sql = "SELECT * FROM  `teachermanagement` WHERE TMuer =  '$TMuer'AND Aduerpwd =  '$Aduerpwd' AND TMClassify =$TMClassify";
				//执行
				$rs = mysql_query($sql);
				if ($rs) {
					$num = mysql_num_rows($rs);
					if ($num == 1) {
						while ($row = mysql_fetch_assoc($rs)) {
							$arr[] = $row;
						}
						echo '{"status":"200","msg":' . json_encode($arr) . '}';
					}
					else
					{
						echo '{"status":"600"}';
					}
				}
			} else {
				//账号错误
				echo '{"status":"50"}';
			} 

		} else {
			//sql语句错误
			echo '{"status":"501"}';
		}
	 
	}  
		if ($_GET) {
		$TMuer = $_GET['TMuer'];
		$Aduerpwd = $_GET['Aduerpwd'];
		$TMClassify=$_GET['TMClassify'];
		//md5加密
		//$userInfo_Pwd = md5(md5($userInfo_Pwd)); 
		//判断账号是否正确
		$masql = "SELECT * FROM teachermanagement WHERE TMuer='$TMuer'"; 
		$msy=mysql_query($masql); 
		if ($msy) {
			$mynamesql = mysql_num_rows($msy);
			if ($mynamesql == 1) {
				$sql = "SELECT * FROM  `teachermanagement` WHERE TMuer =  '$TMuer'AND Aduerpwd =  '$Aduerpwd'AND TMClassify =$TMClassify";
				//执行
				$rs = mysql_query($sql);
				if ($rs) {
					$num = mysql_num_rows($rs);
					if ($num == 1) {
						while ($row = mysql_fetch_assoc($rs)) {
							$arr[] = $row;
						}
						echo '{"status":"200","msg":' . json_encode($arr) . '}';
					}
					else
					{
						echo '{"status":"600"}';
					}
				}
			} else {
				//账号错误
				echo '{"status":"50"}';
			} 

		} else {
			//sql语句错误
			echo '{"status":"501"}';
		}
	 
	}
}
//关闭数据库
mysql_close($con);
?>